package com.xxx.server508.config;

import com.xxx.server508.interceptor.TestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class AdminWebConfig implements WebMvcConfigurer {

    @Autowired
    private TestInterceptor testInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(testInterceptor) //添加自己写的拦截器
                .addPathPatterns("/**");      //所有请求都被拦截包括静态资源
        //.addPathPatterns("/login/test");
//                .excludePathPatterns("/","/login/test","/css/**","/fonts/**","/images/**",
//                        "/js/**","/aa/**");
        //registry.addInterceptor(new TestInterceptor2()).addPathPatterns("/health");
    }
}
